// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asDataStore.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the DataStore class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asDataStore.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../ScriptHelper.h"

#include "../../core/DataStore.h"


//! Binds the DataStore class to AngelScript.
void bindDataStore(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind DataStore class.
    r = engine->RegisterObjectType("DataStore", sizeof(DataStore), asOBJ_REF); assert(r >= 0);

    // Set DataStore behaviour.
    r = engine->RegisterObjectBehaviour("DataStore", asBEHAVE_ADDREF, "void f()",
                                        asMETHOD(DataStore, grab), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("DataStore", asBEHAVE_RELEASE, "void f()",
                                        asMETHOD(DataStore, drop), asCALL_THISCALL); assert(r >= 0);

    // Bind DataStore class functions.
    r = engine->RegisterObjectMethod("DataStore", "void init()",
                                     asMETHOD(DataStore, init), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("DataStore", "void clear()",
                                     asMETHOD(DataStore, clear), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("DataStore", "bool addDataStack(DataStack @+)",
                                     asMETHOD(DataStore, addDataStack), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("DataStore", "DataStack@ createDataStack(const string &in)",
                                     asMETHOD(DataStore, createDataStack), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("DataStore", "DataStack@ createDataStack(const string &in, bool)",
                                     asMETHOD(DataStore, createDataStack), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("DataStore", "DataStack@ getDataStack(const u32)",
                                     asMETHODPR(DataStore, getDataStack, (const u32), DataStack*),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("DataStore", "DataStack@ getDataStack(const string &in)",
                                     asMETHODPR(DataStore, getDataStack, (const std::string &), DataStack*),
                                     asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("DataStore", "void removeDataStacks()",
                                     asMETHOD(DataStore, removeDataStacks), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("DataStore", "bool removeDataStack(DataStack @+)",
                                     asMETHODPR(DataStore, removeDataStack, (DataStack*), bool),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("DataStore", "bool removeDataStack(const u32)",
                                     asMETHODPR(DataStore, removeDataStack, (const u32), bool),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("DataStore", "bool removeDataStack(const string &in)",
                                     asMETHODPR(DataStore, removeDataStack, (const std::string &), bool),
                                     asCALL_THISCALL); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
